Skip to content

Replace SQLite chat history atomically, including empty histories - #1589

Open
Twiink wants to merge 1 commit into
tmc:mainfrom
Twiink:codex/20261128-sqlite-history-atomic
Open

Twiink wants to merge 1 commit into
tmc:mainfrom
Twiink:codex/20261128-sqlite-history-atomic

Conversation

@Twiink

@Twiink Twiink commented Nov 28, 2026

Copy link
Copy Markdown

Replacing SQLite chat history with an empty list currently executes an INSERT without values and fails. An insert error also leaves the DELETE and transaction open, so old messages disappear and later replacements cannot begin a transaction.

Use database/sql's transaction API, roll back unsuccessful replacements, and omit the INSERT for an empty history. Keep the overwrite opt-in and session-scoped DELETE.

Two regressions fail on the original source: empty replacement and preserving the old conversation after a CHECK constraint rejects a replacement. The latter also verifies that a subsequent valid replacement works.

Validation: all memory packages pass with -race on Go 1.26.11 and 1.27.3; repository-wide golangci-lint passes with 0 issues. This branch retains the default branch's dependency versions; existing PR CI reports GO-2026-6278 in the WebSocket dependency, unrelated to this memory change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant